package chouxiang2;

public class animalDemo2 {
    public static void main(String[] args) {
        /*创建对象，按照多态的方式*/
        animal2 a = new cat2();
        a.setName("加菲");
        a.setAge(5);
        System.out.println(a.getName()+","+a.getAge());
        a.eat();
        System.out.println("--------------");
        a = new cat2("加菲", 5);
        System.out.println(a.getName()+","+a.getAge());
        a.eat();
    }
}